<?php
namespace app\common\model;

use think\Model;

class PlatformInfo extends Base
{
    protected $table = 'platform_infos';



    public function getCreateTimeLabelAttr($value, $data)
    {
        if (empty($data['create_time'])) {
            return '暂无';
        }

        return date('Y-m-d H:i:s', $data['create_time']);
    }

    public function getUpdateTimeLabelAttr($value, $data)
    {
        if (empty($data['update_time'])) {
            return '暂无';
        }

        return date('Y-m-d H:i:s', $data['update_time']);
    }

    public function getStatusTimeLabelAttr($value, $data)
    {
        if (empty($data['update_time'])) {
            return '暂无';
        }

        return date('Y-m-d H:i:s', $data['status_time']);
    }

    public function getBusinessLicenseLabelAttr($value, $data)
    {
        if (empty($data['business_license'])) {
            return array();
        }

        return explode(';', $data['business_license']);

    }

    public function getCorporateIdentityCardLabelAttr($value, $data)
    {
        if (empty($data['corporate_identity_card'])) {
            return array();
        }

        return explode(';', $data['corporate_identity_card']);

    }

    public function getCompanyImgLabelAttr($value, $data)
    {
        if (empty($data['company_img'])) {
            return array();
        }

        return explode(';', $data['company_img']);
    }

    public function getPlatformIdLabelAttr($value, $data)
    {
        $platform = Platform::get(array('id' => $data['platform_id']));

        if (empty($platform)) {
            return '';
        }

        return $platform['name'];
    }


}